// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
Vue.config.productionTip = false
import Vue from 'vue'
import App from './App'
import router from './router'
// 引入element组件
import element from './element/index'
import {Message,MessageBox} from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
// 导入过滤器
import filter from './utils/filter'

/* 导入全局样式 */
import './assets/css/global.css'

/* 配置请求的跟路径 */
axios.defaults.baseURL = 'http://localhost:3030/'
axios.interceptors.request.use (config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

/* 导入axios */
Vue.prototype.$http = axios

// element组件
Vue.use(element)

// 全局导入过滤器
Object.keys(filter).forEach(key => Vue.filter(key, filter[key]))

Vue.config.productionTip = false
// 全局导入消息提示框
Vue.prototype.$message = Message
Vue.prototype.$msgbox = MessageBox 
Vue.prototype.$alert = MessageBox  
Vue.prototype.$confirm = MessageBox 

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
